import { IsNotEmpty, IsOptional, IsString, Length } from 'class-validator'

export class createImageCodeDto {
  @IsString()
  @IsNotEmpty({ message: '浏览器指纹不能为空' })
  readonly murmur: string
}


export class userRegisterDto {
  @IsString()
  @IsNotEmpty({ message: '用户名不能为空' })
  readonly userName: string

  @IsString()
  @IsNotEmpty({ message: '密码不能为空' })
  readonly userPwd: string

  @IsString()
  @IsOptional({ context: '用户昵称' })
  readonly userNickname?: string

  @IsString()
  @IsOptional({ context: '用户头像' })
  readonly userAvatar?: string
}

export class userLoginDto {
  @IsString()
  @IsNotEmpty({ message: '用户名不能为空' })
  readonly userName: string

  @IsString()
  @IsNotEmpty({ message: '密码不能为空' })
  readonly userPwd: string

  @IsString()
  @IsNotEmpty({ message: '浏览器指纹不能为空' })
  readonly murmur: string

  @IsString()
  @Length(4, 4, { message: '验证码长度必须为4位' })
  @IsNotEmpty({ message: '验证码不能为空' })
  readonly verificationCode: string
}
